<?php

/**
 * This file is part of the Pagizer package.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @copyright   Copyright (c) 2010 Advisa (http://www.advisa.fr)
 * @author      Pagizer Core Team <team@pagizer.org>
 * @package     pagizer
 * @subpackage  website
 */

/**
 * Generic gallery block edition
 */
class m_medias_actions_block_front_GalleryEditAction extends m_backoffice_extends_BlockEditModal
{
	public function execute()
	{
        $this->setModalParameters();

        if($this->isFormSubmit())
        {
            $this->saveBlockAndClose();
        }

        $list = m_backoffice_services_SelectService::getInstance()->setRootNodeByModuleName('medias')
                                                                  ->setModelsToGet(array("modules_backoffice/folder"))
                                                                  ->setFolderModule("medias")
                                                                  ->showRoot(false)
                                                                  ->currentId($this->getBlockParameter('folder'))
                                                                  ->execute();

        $this->addToModel('hasValues', $list->getSelectableItemsNb() > 0);
        $this->addToModel('folders', $list->getSelectContent());
        $this->setView('success');
	}    
}